import 'package:flutter/material.dart';
import 'package:flutter_taotaoshipin/pages/drama/darma_page.dart';
import 'package:flutter_taotaoshipin/pages/home/home_page.dart';
import 'package:flutter_taotaoshipin/pages/me/me_page.dart';
import 'package:flutter_taotaoshipin/pages/recommend/recommend_page.dart';
import 'package:flutter_taotaoshipin/widget/load_image.dart';
import 'package:get/get.dart';

class RootTabState {
  static const double _imageSize = 24.0;

  ///选择index
  late RxInt selectedIndex;

  ///Navigation的item信息
  late List<BottomNavigationBarItem> itemList;

  ///PageView页面
  late List<Widget> pageList;
  late PageController pageController;

  RootTabState() {
    /// 初始化index
    selectedIndex = 1.obs;

    /// PageView页面
    pageList = [
      const RecommendPage(),
      const HomePage(),
      const DarmaPage(),
      const MePage(),
    ];

    /// item栏目
    itemList = const [
      BottomNavigationBarItem(
        icon: LoadAssetImage(
          'tab/recommend',
          width: _imageSize,
        ),
        activeIcon: LoadAssetImage(
          'tab/recommend_sel',
          width: _imageSize,
        ),
        label: '推荐',
      ),
      BottomNavigationBarItem(
        icon: LoadAssetImage(
          'tab/home',
          width: _imageSize,
        ),
        activeIcon: LoadAssetImage(
          'tab/home_sel',
          width: _imageSize,
        ),
        label: '首页',
      ),
      BottomNavigationBarItem(
        icon: LoadAssetImage(
          'tab/drama',
          width: _imageSize,
        ),
        activeIcon: LoadAssetImage(
          'tab/drama_sel',
          width: _imageSize,
        ),
        label: '剧场',
      ),
      BottomNavigationBarItem(
        icon: LoadAssetImage(
          'tab/me',
          width: _imageSize,
        ),
        activeIcon: LoadAssetImage(
          'tab/me_sel',
          width: _imageSize,
        ),
        label: '我的',
      ),
    ];

    /// 页面控制器
    pageController = PageController(initialPage: 1);
  }
}
